package com.crm.system.service.impl.customerManager;

import com.crm.common.model.DhPageInfo;
import com.crm.model.qo.customerManager.CustomerRawDataQO;
import com.crm.model.vo.customerManager.CustomerRawDataVO;
import com.crm.service.customerManager.CustomerRawDataDbService;
import com.crm.system.service.customerManager.CustomerRawDataService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @ Author ：pym
 * @ Date   ：2021/7/20 10:15
 */
@Service
public class CustomerRawDataServiceImpl implements CustomerRawDataService {
    @Autowired
    private CustomerRawDataDbService customerRawDataDbService;

    /**
     * 客户原始数据
     * @Author pym
     * @Date  2021/7/20 11:03
     * @param pageIndex -页码
     * @param pageSize -分页大小
     * @param sortName -排序列名字
     * @param sortOrder -排序规则(asc/desc)
     * @param customerRawDataQO -查询条件
     * @return {@link {com.crm.common.model.DhPageInfo<com.crm.model.vo.customerManager.CustomerRawDataVO>}}
     */
    @Override
    public DhPageInfo<CustomerRawDataVO> selectCustomerRawDataList(Integer pageIndex, Integer pageSize, String sortName, String sortOrder, CustomerRawDataQO customerRawDataQO) {
        List<CustomerRawDataVO> customerRawDataList = new ArrayList<CustomerRawDataVO>();
        if (pageIndex != null && pageSize != null) {
            PageHelper.startPage(pageIndex, pageSize);
        }
        customerRawDataList = customerRawDataDbService.selectCustomerRawDataList(customerRawDataQO);
        PageInfo<CustomerRawDataVO> pageInfo = new PageInfo<CustomerRawDataVO>(customerRawDataList);
        return new DhPageInfo<CustomerRawDataVO>(pageInfo, customerRawDataList);
    }

}
